﻿using System;
using System.Configuration;

namespace Web.ascx
{
    public partial class Menu : ControlUsuario
    {
        protected int mPerfil;

        public int Perfil
        {
            get { return mPerfil; }
            set { mPerfil = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            ActualizaReportPeriodo();
        }

        public void ActualizaReportPeriodo()
        {
            if (PeriodoActual == null)
            {
                pnlMenu.Visible = false;
                return;
            }

            pnlMenu.Visible = true;

            // Actualizar URL's de Reporing Services

            lnkCargaInicialReporteMaestroSAP.NavigateUrl = ConfigurationManager.AppSettings["rptCargaInicial"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkTIPReporteDashboardLider.NavigateUrl = ConfigurationManager.AppSettings["rptDashboardLider"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkTIPReporteDashboardBodega.NavigateUrl = ConfigurationManager.AppSettings["rptDashboardBodega"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkTIPReportePreCuadraturaMenu.NavigateUrl = ConfigurationManager.AppSettings["rptPreCuadraturaMenu"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkTIPReporteCuadraturaMenu.NavigateUrl = ConfigurationManager.AppSettings["rptCuadraturaMenu"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkTIPReporteLogsTomas.NavigateUrl = ConfigurationManager.AppSettings["rptLogsTomas"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);

            lnkCuadFinalGeneral.NavigateUrl = ConfigurationManager.AppSettings["rptCuadFinalGeneral"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkCuadFinalDesubicados.NavigateUrl = ConfigurationManager.AppSettings["rptCuadFinalDesubicados"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkCuadFinalFaltantes.NavigateUrl = ConfigurationManager.AppSettings["rptCuadFinalFaltantes"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
            lnkCuadFinalSobrantes.NavigateUrl = ConfigurationManager.AppSettings["rptCuadFinalSobrantes"].Replace("[ServidorReportingServices]", ServidorReportingServices).Replace("[CarpetaReportingServices]", CarpetaReportingServices).Replace("[Periodo]", PeriodoActual.Llave);
        }
    }
}